import { createApp } from 'vue'
import { setupStore } from '@/store'
import router from '@/router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// main.ts/main.js
import 'element-plus/theme-chalk/dark/css-vars.css'
import 'element-plus/theme-chalk/el-loading.css'
import 'element-plus/theme-chalk/el-message.css'
import 'element-plus/theme-chalk/el-notification.css'
import 'element-plus/theme-chalk/el-message-box.css'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'bootstrap-icons/font/bootstrap-icons.css'
import { setupAuthDirective } from '@/utils/directives'

import App from './App.vue'

import './assets/css/main.scss'
import 'virtual:uno.css'

async function bootstrap() {
  const app = createApp(App)
  setupStore(app)
  app.use(router)
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
  app.use(ElementPlus, {
    locale: zhCn
  })

  // Configure directive
  setupAuthDirective(app)

  app.mount('#app')
}

bootstrap()
